Where is the Mouse?

Description

This example shows how to detect which control the cursor is over. The script uses the {TIMER} event to periodically call the UI_DLG_CONTROL_FROM_POS()function, which returns the location of the cursor.

dim dlg_title as C
dlg_title = "Where is the Mouse"
ui_dlg_box(dlg_title,<<%dlg%
{wrap=100}
Move the mouse around the dialog. Notice that as you move the mouse, the current control's definition is shown.;
{timer=timer}
{interval=.05}
{line=1,0};
{lf};
{region}
First name: |[.20fname];
Last name: |[.20lname];
City: |[.20city] State: [.4state] Zip: [.6zip];
{endregion};
{line=1,0};
{region};
Current control:;
{frame=1,1}
{region}
{text=80,2:current_control};
{endregion};
;
{endregion};
{lf};
<10&OK!ok> <10&Cancel!cancel>;
%dlg%,<<%code%
if (a_dlg_button = "timer") then
    a_dlg_button = ""
    current_control = ui_dlg_control_from_pos(dlg_title)
    current_control = remove_blank_lines(current_control)
end if
%code%)

Limitations

Desktop applications only

See Also